<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page session="false"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<jsp:include page="/WEB-INF/pages/header/header.jsp" />
<div class="main-content">
	<div class="main-left">
		<s:iterator value="#request['result']" id="item">
		<div class="left-content">
			<div class="book-main-div">
				<div class="book-topic-div"><s:property value="#item.topic"/></div>
				<div class="book-time-div">
					<s:property value="#item.name"/>&nbsp;<s:text name="guestbook.postat"/>:&nbsp;<s:date name="#item.insertDate" format="yyyy-MM-dd HH:mm" />
				</div>
				<div class="book-content-div"><s:property value="#item.content"/>
				<s:iterator value="#item.comments" id="comment">
					<div class="book-comment">
						<s:property value="#comment.content"/>
						<hr/>
						<s:property value="#comment.name"/><s:text name="guestbook.postat" /><s:date name="#comment.date" format="yyyy-MM-dd HH:mm"/>
					</div>
				</s:iterator>
				</div>
				<div class="book-response-link"><a href="javascript:void(0);" id="<s:property value='#item.guestBookId' />" class="response-book" ><s:text name="guestbook.response"/></a></div>
			</div>
		</div>
		</s:iterator>
		<s:if test="#request.paginated">
		<div class="book-page">
		<s:if test="#request.current == 0"><s:text name="pagination.first"/>&nbsp;<s:text name="pagination.previous"/>&nbsp;</s:if>
		<s:else>
			<s:url id="firstUrl" action="%{#request['url']}">
				<s:param name="current" value="0"/>
			</s:url>
			<s:a href="%{firstUrl}"><s:text name="pagination.first"/></s:a>&nbsp;
			<s:url id="previousUrl" action="%{#request['url']}">
				<s:param name="current" value="%{#request['previous']}"/>
			</s:url>
			<s:a href="%{previousUrl}"><s:text name="pagination.previous"/></s:a>&nbsp;
		</s:else>
		<s:if test="#request.next !=null">
			<s:url id="nextUrl" action="%{#request['url']}">
				<s:param name="current" value="%{#request['next']}"/>
			</s:url>
			<s:a href="%{nextUrl}"><s:text name="pagination.next"/></s:a>&nbsp;
			<s:url id="lastUrl" action="%{#request['url']}">
				<s:param name="current" value="%{#request['last']}"/>
			</s:url>
			<s:a href="%{lastUrl}"><s:text name="pagination.last"/></s:a>&nbsp;
		</s:if>
		<s:else>
			<s:text name="pagination.next"/>&nbsp;<s:text name="pagination.last"/>&nbsp;
		</s:else>
		</div>
		</s:if>
		<form action="guestbook.action" method="post">
			<fieldset>
				<legend><s:text name="guestbook.leavemessage"/></legend>
				<table>
					<tr>
						<td class="book-col-td-left"><s:text name="guestbook.topic"/>：</td>
						<td class="book-col-td-right">
							<input type="text" id="bookTopic" name="bookTopic" class="book-text" required="required" placeholder="<s:text name="guestbook.inputTopic"/>"/>
						</td>
					</tr>
					<tr>
						<td class="book-col-td-left"><s:text name="guestbook.content"/>：</td>
						<td class="book-col-td-right" >
							<textarea class="book-textarea" id="bookContent" name="bookContent" ></textarea>
						</td>
					</tr>
					<tr>
						<td class="book-col-td-left"><s:text name="guestbook.email"/>：</td>
						<td class="book-col-td-right" >
							<input type="email" class="common-text" required="required" placeholder="<s:text name="guestbook.inputUserEmail" />" id="postEmail" name="email"  />&nbsp;
						</td>
					</tr>
					<tr>
						<td class="book-col-td-left"><s:text name="guestbook.userName"/>：</td>
						<td class="book-col-td-right" >
							<input type="text" class="common-text" required="required" placeholder="<s:text name="guestbook.inputUserName" />" id="postName" name="postName"  />
						</td>
					</tr>
					<!-- Vericode is disabled because google app engine could not generate image dynamically
					<tr>
						<td class="book-col-td-left">验证码：</td>
						<td class="book-col-td-right">
							<input type="text" required="required" placeholder="验证码" class="short-text" />
						</td>
					</tr>
					 -->					
					<tr>
						<td class="book-col-td-left">
						</td>
						<td class="book-col-td-right">
							<input type="submit" class="submit-button" value="<s:text name="guestbook.say"/>" />&nbsp;
							<input type="reset" class="submit-button" value="<s:text name="guestbook.reset"/>" />
						</td>
					</tr>					
				</table>
			</fieldset>
		</form>
	</div>
	<jsp:include page="/WEB-INF/pages/footer/right.jsp"></jsp:include>
</div>
<jsp:include page="/WEB-INF/pages/footer/footer.jsp" />